package com.chuanye.mydrawable.adapters;

import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.chuanye.mydrawable.R;
import com.chuanye.mydrawable.beans.LocaInfoBean;

import java.util.List;

/**
 * Created by lsef on 2019/1/22.
 */

public class LocaInfoAdapter extends BaseAdapter{
    private Context mContext;
    private List<LocaInfoBean.ListBean> listBeanList;

    public LocaInfoAdapter(Context mContext, List<LocaInfoBean.ListBean> listBeanList) {
        this.mContext = mContext;
        this.listBeanList = listBeanList;
    }

    @Override
    public int getCount() {
        return listBeanList.size();
    }

    @Override
    public Object getItem(int i) {
        return listBeanList.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder holder = null;
        if (view == null){
            view = View.inflate(mContext, R.layout.repairman_item,null);
            holder = new ViewHolder();
            holder.repairman_item_tv = view.findViewById(R.id.repairman_item_tv);
            view.setTag(holder);
        }
        holder = (ViewHolder) view.getTag();
        Log.i("输出站名：",listBeanList.get(i).getLocaName());
        holder.repairman_item_tv.setText(listBeanList.get(i).getLocaName());
        return view;
    }

    private static class ViewHolder{
        TextView repairman_item_tv;
    }
}
